home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Frameworks / Extension Shell 1.3 / Sample Extensions / Shutdown Fade ƒ / Fade.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-06  |  1.8 KB  |  85 lines  |  [TEXT/R*ch]

  1. /*    NAME:
  2.         Fade.c
  3.  
  4.     WRITTEN BY:
  5.         Dair Grant
  6.                 
  7.     DESCRIPTION:
  8.         This file contains a CODE resource to be installed as a Shutdown task.
  9.  
  10.     NOTES:
  11.         •    Causes all monitors to fade to black when the Mac shuts down.
  12.  
  13.     ___________________________________________________________________________
  14.  
  15.     VERSION HISTORY:
  16.         (Jan 1994, dg)
  17.             •    First publicly distributed version.
  18.  
  19.  
  20.     ___________________________________________________________________________
  21. */
  22. //=============================================================================
  23. //        Include files                                                                     
  24. //-----------------------------------------------------------------------------
  25. #include "StandaloneCode.h"
  26. #include "AddrsTable.h"
  27. #include "ESConstants.h"
  28. #include "CodeConstants.h"
  29. #include "Gamma.h"
  30.  
  31.  
  32.  
  33.  
  34.  
  35. //=============================================================================
  36. //        Private function prototypes                                                                     
  37. //-----------------------------------------------------------------------------
  38. pascal    void main(void);
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. //=============================================================================
  50. //        main : Entry point to our code resource.                                                                 
  51. //-----------------------------------------------------------------------------
  52. //        Note :    We fade all the monitors down to black.
  53. //-----------------------------------------------------------------------------
  54. pascal void main(void)
  55. {    int                    i;
  56.  
  57.  
  58.  
  59.  
  60.     // Get access to our globals, and save off A4
  61.     PatchGetGlobals();
  62.  
  63.     
  64.  
  65.     // Initialise the Gamma Tools library, and do nothing if we can't use it
  66.     if (SetupGammaTools() == noErr)
  67.         {
  68.         if (IsGammaAvailable())
  69.             {
  70.             // If it all went OK, fade down slowly
  71.             for (i = 100; i >= 0; i -= 3)
  72.                 DoGammaFade(i); 
  73.     
  74.     
  75.             // And tear down the library
  76.             DisposeGammaTools();
  77.             }
  78.         }
  79.         
  80.     
  81.     
  82.     // Restore A4 for our caller
  83.     PatchUngetGlobals();
  84. }
  85.